"""
    Task对象就是从Future继承而来
"""
import asyncio


async def set_after(future):
    await asyncio.sleep(1)
    future.set_result('hello')


async def func():
    # 获取事件循环
    loop = asyncio.get_running_loop()
    # 创建一个Future对象
    future = loop.create_future()

    await loop.create_task(set_after(future))
    # 等待future对象执行结果
    data = await future

    print(data)


asyncio.run(func())
